import Vue from 'vue' // 引入 vue
import App from './App' // 引入 App.vue
import store from './store' // 引入 vuex
import router from './router' // 引入 vue-router
import Element from 'element-ui' // elementUI
import Cookies from 'js-cookie' // 引入 cookiejs
import imageUpload from './components/imageUpload/imageUpload.vue'
Vue.component('image-upload', imageUpload)

import './icons' // 图标库
import './permission' // 权限控制
import '@/styles/index.scss' // 全局样式
import 'normalize.css/normalize.css' // css reset 方案
import './styles/element-variables.scss' // elementUI 样式
import Plugin from './plugins'
import vueCropper from 'vue-cropper'
Vue.use(vueCropper)
Vue.use(Plugin)
Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // 设置 Element 默认字号
})
Vue.prototype.$baseUrl = 'http://www.mfzj.com:8888'
Vue.prototype.$showLoading = (val) => { // 全局加载等待弹窗
  const loading = Vue.prototype.$loading({
    lock: true,
    text: '正在操作，请稍后...',
    spinner: 'el-icon-loading',
    background: 'rgba(0, 0, 0, 0.7)'
  })
  setTimeout(() => {
    loading.close()
  }, 4000)
  if (val === 'close') {
    loading.close()
  }
}
Vue.prototype.$operateTip = (title, msg, type) => {
  Vue.prototype.$notify({
    title: title || '成功',
    message: msg || '操作成功！',
    type: type || 'success',
    duration: 2000
  })
}
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
